package com.hmy.infrastructure.api.fallback.corpsearch;

import cn.hutool.json.JSONUtil;
import com.hmy.ccp.common.result.FeignResult;
import com.hmy.ccp.common.result.Results;
import com.hmy.infrastructure.api.bo.request.corpsearch.CorpDetailSearchRequest;
import com.hmy.infrastructure.api.bo.request.corpsearch.CorpSearchRequest;
import com.hmy.infrastructure.api.bo.response.corpsearch.CorpDetailClientResponse;
import com.hmy.infrastructure.api.bo.response.corpsearch.CorpSearchResponse;
import com.hmy.infrastructure.api.client.corpsearch.CorpSearchFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 *
 */
@Slf4j
@Component
public class CorpSearchFeignClientFallback implements CorpSearchFeignClient {
    @Override
    public FeignResult<CorpSearchResponse> corpListSearch(CorpSearchRequest corpSearchRequest) {
        log.error("调用[HMY-CCP-INFRASTRUCTURE]服务的[根据企业名称进行企业列表查询（模糊匹配）][/feign/corp-search/list]发生熔断,请求信息是:{}", JSONUtil.toJsonStr(corpSearchRequest));
        return Results.newSuccessResult(new CorpSearchResponse());
    }

    @Override
    public FeignResult<CorpDetailClientResponse> corpDetailSearch(CorpDetailSearchRequest detailSearchRequest) {
        log.error("调用[HMY-CCP-INFRASTRUCTURE]服务的[根据企业全称从三方查询工商详细信息][/feign/corp-search/detail]发生熔断,请求信息是:{}", JSONUtil.toJsonStr(detailSearchRequest));
        return Results.newSuccessResult(new CorpDetailClientResponse());
    }
}
